home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / WWIV Mods / COMMON21.ZIP / COMMON.MOD < prev    next >
Encoding:
Text File  |  1994-07-07  |  12.8 KB  |  342 lines

  1. /* *********************************************************************** */
  2. /* Asylum COMMON - by Michael Deweese Copyright 1994                       */
  3. /*                                                                         */
  4. /* You may use this code in WWIV as installed under the COMMON.MOD file    */
  5. /* You may not use this code in your own programs without the consent of   */
  6. /* Michael Deweese.                                                        */
  7. /* You can call these functions from your own WWIV modifications, but may  */
  8. /* not rip these out and include them in your mod.  In other words, to     */
  9. /* access these functions, the user using your modification must have      */
  10. /* mod installed                                                           */
  11. /*                                                                         */
  12. /* Again, feel free to make mods requiring COMMON to be installed, just    */
  13. /* as I do, but I really don't want these function ripped apart and        */
  14. /* and included in individual mods, and it would make it impossible for me */
  15. /* to maintain them.                                                       */
  16.  
  17.  
  18.  
  19. ═══════════════════════════════════════════════════════════════════════════════
  20.   ModTitle: Asylum Common v2.1 for 4.23              Last Update July 6, 1994
  21.   Mods that use this mod will be referred to as a 'Common Mod'
  22.  
  23.   Difficulty: Typical Asylum Mod...that is, a piece of cake.
  24.  
  25.   Files affected: MAKEFILE, VARDEC.H, VARS.H
  26.  
  27.   A tool box of functions that the Asylum group (and any one else who wants to)
  28.   use in the modifications for WWIV.
  29.  
  30.   Current mods requiring this mod: Pulldown Menus, Listfile Plus Q/Nscan
  31.                                    Config Plus and our QWK modification
  32.  
  33.   BY: Asylum Group-  Zu Digital, 1@8421, and Sam, 1@4051
  34.   Credits: No one
  35. ═══════════════════════════════════════════════════════════════════════════════
  36.  
  37.  
  38. Fixes and updates:
  39.   2.1 added high level ini
  40.  
  41.   Added giveup_timeslice in get_kb_event
  42.  
  43.   Fixed the fact that the insert and delete were not recognized by my Telemate
  44.   on the remote side.
  45.  
  46.   Delete would show a little house (ascii 127) and insert just didn't do
  47.   anything.
  48.  
  49.  
  50.  
  51. + Add
  52. - Subtract
  53. * Change
  54. = Existing
  55. @# See number
  56.  
  57.     
  58.   I will not be responsible for any problems that arise because of this or any
  59.   other of my mods.  If you have something to lose, make a way to recover it.
  60.   If you don't know how to do this properly, then don't install this.
  61.   If you can't install this mod without any problems, then don't try.
  62.   
  63.   Now,... this mod works as far as I have tested, as has many other people.
  64.   
  65.  
  66. ***Note  (Pertains to people upgrading from an older version of common)
  67.   I removed the register_common mod stuff, the stuff that goes at the begining
  68.   of bbs.c in main(), you will need to remove all that code that pertains to
  69.   it once this is installed to get it to compile.  Reason is, it never
  70.   developed into anything useful, and just took away precious memory, I modified
  71.   it slightly so that when you 'show_common_mods', it will just print a file,
  72.   forget which, but that way, you can just add the mods you put in, into some
  73.   .MSG or ANS and it will be printed out.
  74.  
  75.  
  76. ***** If you are upgrading from version 1.anything or do the following to
  77. ***** upgrade
  78.  
  79. Step 4A
  80.      4B
  81.      4E
  82.  
  83.      Copy COMMON.C AND COMMON2.C, COMMON.H into your dir
  84.  
  85.      Rebuild your FCNS.H file (MAKE FCNS or get declarations from step 5)
  86.  
  87.      Done!
  88.  
  89. ***** End of upgrade
  90.  
  91.  
  92.  
  93. Step A)
  94.   Place the included files in your compling directory, should include COMMON.C,
  95.   COMMON2.C and COMMON.H.
  96.   
  97.  
  98. Step 1) VARDEC.H
  99.   Going to make a way to turn off certain Asylum mods, and don't want to change
  100.   your userrec for every mod.
  101.  
  102.   This will take only 8 bits from your user rec (1 BYTE).
  103.  
  104.   NOTE: If you already modified your userrec at this same spot, put this before
  105.   your previous mod so that all memory will point to the correct spot.  And that
  106.   goes for future mods at this spot, if you add another variable, add it before
  107.   the declarations.
  108.  
  109. =     char
  110. =       res_float[32];  /* reserved for real values */
  111. =
  112. =     char
  113. /*********  Be sure to decrement this by 1, ie 100 to 99
  114. *       res_gp[99];    /* reserved for whatever */
  115. =
  116.  
  117. +     unsigned char use_internal_tag : 1;
  118. +     unsigned char use_menusys : 1;
  119. +
  120. +     unsigned char use_three : 1;
  121. +     unsigned char use_four : 1;
  122. +     unsigned char use_five : 1;
  123. +     unsigned char use_six : 1;
  124. +     unsigned char use_seven : 1;
  125. +     unsigned char use_eight : 1;
  126.  
  127. } userrec;
  128.  
  129.  
  130.   
  131.   
  132. Step 2) VARS.H
  133.   Have vars.h include common.h into your bbs as well as a simple define
  134.   
  135. = #include <dos.h>
  136. = #include <alloc.h>
  137. = #include <time.h>
  138.                        /***********  Read !!!!!!!!! ***********/
  139. + #include "common.h"  /*********** important, make sure this is before fcns.h ***********/
  140. = #include "fcns.h"    /*********** Did you read ^^^^^??????????? *********/
  141.  
  142.  
  143.  
  144.  
  145. Step 3) BBS.C
  146.   Put in a check to give us an error if we mess up on the userrec
  147.  
  148. = void main(int argc, char *argv[])
  149. = {
  150. =   char s[81],ch,frc[81], rf[30],*ss;
  151. =   int i,i1,num_min=0;
  152. =   unsigned int ui=0, us=0;
  153. =   double dt;
  154. =   unsigned short c_s,c_o;
  155. =   int this_usernum=0;
  156. =
  157. + #if sizeof(userrec) != 1024
  158. + #error Userrec is not 1024
  159. + #endif
  160.  
  161.  
  162. Step 4)
  163.   MAKEFILE.  This is only for the Borland make, if you don't use it, then you
  164.   will have to modify your makefile yourself, being that I don't use it, and
  165.   do not know the syntax.
  166.   
  167.   A) Search for BBS_NRM and add our non-overlaid part of common
  168.  
  169. = BBS_NRM = \
  170. =        msgbase.obj  msgbase1.obj share.obj    strings.obj  \
  171. *        utility.obj  xfer.obj     common2.obj
  172.                                   ^^^^^^^^^^^ add this
  173.  
  174.   B) Down a little add our other part
  175.  
  176. = BBS_O_NRM = \
  177. =        $(OBJ)\msgbase1.obj $(OBJ)\share.obj    $(OBJ)\strings.obj  \
  178. *        $(OBJ)\utility.obj  $(OBJ)\xfer.obj     $(OBJ)\common2.obj
  179.                                                  ^^^^^^^^^^^^^^^^^^ add this
  180.  
  181.  
  182.   C) Search for BBS_OVL and add the common.obj to the end of it, to add
  183.      our overlaid part
  184.   
  185. =       sysopf.obj   tedit.obj    uedit.obj    voteedit.obj \
  186. *       xferovl.obj  xfertmp.obj  xinit.obj    common.obj
  187.                                                ^^^^^^^^^^ added part
  188.   D) Go down a little to BBS_O_OVL
  189.   
  190. =        $(OBJ)\voteedit.obj $(OBJ)\xferovl.obj  $(OBJ)\xfertmp.obj  \
  191. *        $(OBJ)\xinit.obj $(OBJ)\common.obj
  192.                           ^^^^^^^^^^^^^^^^^ added part
  193.  
  194.   E) Down a little to the NON-OVERLAID PART
  195.  
  196. = share.obj   : share.c
  197. =   $(TCC_NRM)
  198. = utility.obj : utility.c
  199. =   $(TCC_NRM)
  200. = xfer.obj    : xfer.c
  201. =   $(TCC_NRM)
  202. + common2.obj : common2.c
  203. +   $(TCC_NRM)
  204.  
  205.  
  206.  
  207.   F) And now... down a ways... (IN THE OVERLAID PART)
  208.  
  209. xfertmp.obj : xfertmp.c
  210.   $(TCC_OVL)
  211. xinit.obj   : xinit.c
  212.   $(TCC_OVL)
  213. + common.obj : common.c
  214. +  $(TCC_OVL)
  215.  
  216.  
  217. Step 5)
  218.     FCNS.H
  219.     
  220.     Either update your fcns.h by typing make fcns or by manually inserting
  221.     the following defenitions:
  222.     
  223.     These must go in between the #ifndef _FCNS_H_ and the final #endif
  224.  
  225. /* File: common2.c */
  226.  
  227. int find_batch_queue(char *fn);
  228. void remove_batch(char *fn);
  229. void CLS(void);
  230. void CEOL_XY( unsigned x, unsigned y );
  231. void CURSORUP( int x );
  232. void CURSORDOWN( int x );
  233. void CURSORRIGHT(int x);
  234. void CURSORLEFT(int x);
  235. void CHAR_XY( int x, int y, int z );
  236. void XCTRPRINTF(int y, char *str );
  237. void PRINTF_XY( int x, int y, char *str );
  238. void BEEP(void);
  239. void EOL(void);
  240. void SAVCURS(void);
  241. void RECALLCURS(void);
  242. char *pad_string(char *string, int length);
  243. char *pad_string_bg(char *string, int length, int bg);
  244. char *justify_string(char *string, int length, int bg, int type);
  245. int pd_amount_in_list(char *list, int rows, int cols);
  246. int largest_in_list(char *list, int rows, int cols);
  247. int widest_in_list(char *list[], int amount);
  248. int wwiv_strlen(char *s);
  249. int count_list(char *list[]);
  250. int search_list(char **list, char *search, int amount_in_list);
  251. int search_list_i(char **list, char *search, int amount_in_list);
  252. void outstr_color(char *s);
  253. void outchr_color(char c);
  254. void npr_color(char *fmt, ...);
  255. char * strip_string(char *string);
  256. char *unalign(char *filename);
  257. void buildfor(unsigned char attr, char *s);
  258. void buildback(unsigned char attr, char *s);
  259. void repeat_char(unsigned char x, int amount);
  260. char *strstr_nocase(char *s1, char *s2);
  261. void statusbar(statusbarrec *sb);
  262. void strip_heart_colors(char *text);
  263.  
  264. /* File: common.c */
  265.  
  266. unsigned char pd_getkey(void);
  267. char pd_inkey(void);
  268. unsigned side_menu(int *menu_pos, int redraw, char *menu_items[], int xpos, int ypos, struct side_menu_colors *smc);
  269. int new_control_break(void);
  270. unsigned get_kb_event(void);
  271. char onek_ncr(char *s);
  272. int do_sysop_command(unsigned command);
  273. void colorize_text(char *buffer);
  274. void sprintf_color(char *buffer, char *fmt, ...);
  275. void show_common_mods(void);
  276. int copyfile(char *src, char *dst, int stats);
  277. int movefile(char *src, char *dst, int stats);
  278. char **alloc_2d(int row, int col, unsigned size);
  279. void free_2d(char **pa);
  280. varimenurec * addvarimenu(varimenurec *current, varimenurec *newitem);
  281. void varimenuforward(varimenurec *menu, varimenuinfo *info);
  282. void varimenubackward(varimenurec *menu, varimenuinfo *info);
  283. void varimenuleft(varimenurec *menu, varimenuinfo *info);
  284. void varimenuup(varimenurec *menu, varimenuinfo *info);
  285. void varimenuright(varimenurec *menu, varimenuinfo *info);
  286. void varimenudown(varimenurec *menu, varimenuinfo *info);
  287. void varimenu(varimenurec *menu, varimenuinfo *info);
  288. varimenurec * getvarimenurec(varimenurec *menu, int which);
  289. void redrawvarimenu(int redraw, varimenurec *menu, varimenuinfo *info);
  290. void killvarimenu(varimenurec *menu);
  291. void kill_inputrec(inputeditrec *input);
  292. void kill_showtextrec(showtextrec *text);
  293. void kill_radiobutton(radiobuttonrec *radio);
  294. void kill_checkbox(checkboxrec *check);
  295. int varimenu_findhotkey(varimenurec *menu, varimenuinfo *info);
  296. void fillvarimenurec(varimenurec *menu, void *rec, int type, unsigned hotkey, int returnvalue, int active);
  297. void build_inputrec(inputeditrec *input, int maxlen, int xpos, int ypos, int width, int insert, int char_case);
  298. void build_radiobuttonrec(radiobuttonrec *radio, int xpos, int ypos, int amount, int pos, int rc, int fc);
  299. void build_checkboxrec(checkboxrec *check, int xpos, int ypos, int amount, int pos, unsigned bi, int rc, int fc);
  300. void radio_button(radiobuttonrec *radio, varimenuinfo *info);
  301. void check_box(checkboxrec *check, varimenuinfo *info);
  302. void input_edit(inputeditrec *input, varimenuinfo *info);
  303. int ok_char_inputedit(inputeditrec *input, varimenuinfo *info);
  304. void add_char_inputedit(inputeditrec *input, varimenuinfo *info);
  305. void redrawinputedit(int type, inputeditrec *input, varimenuinfo *info, int mode);
  306. void delete_inputedit(inputeditrec *input, varimenuinfo *info);
  307. void redrawradiobutton(int redraw, radiobuttonrec *radio, varimenuinfo *info, int mode);
  308. void redrawcheckbox(int redraw, checkboxrec *check, varimenuinfo *info, int mode);
  309. void redrawshowtext(int redraw, showtextrec *text, varimenuinfo *info, int mode);
  310. void showtext(showtextrec *text, varimenuinfo *info);
  311. void build_showtextrec(showtextrec *text, int xpos, int ypos, int width, char *t, int justify, int bg);
  312. void test_vm(void);
  313. void wait_sec_or_hit(double seconds);
  314. void wait_sec(double seconds);
  315. long filesize(FILE *stream);
  316. int fset_rec(FILE *stream, unsigned rec, unsigned rec_size);
  317. int set_rec(int filenum, unsigned rec, unsigned rec_size);
  318. int check_bitfield(unsigned bitfield, char *which);
  319. void test_check_bitfield(void);
  320. int check_arc(char *filename);
  321. int match_archiver(char *filename);
  322. long file_daten(char *filename);
  323. int input_common(char *dst, int max_size, char *dft);
  324. void build_inputpicrec(inputpicrec *input, int xpos, int ypos, int width, int insert, char *picture);
  325. void kill_inputpic(inputpicrec *input);
  326. void input_picture(inputpicrec *input, varimenuinfo *info);
  327. int ok_char_inputpic(inputpicrec *input, varimenuinfo *info);
  328. char ** read_picture(char *picture);
  329. void redrawinputpic(int type, inputpicrec *input, varimenuinfo *info, int mode);
  330. int get_ini_value(char *fname, char *area, char *indent, char *value, int max_value);
  331. int put_ini_value(char *fname, char *area, char *indent, char *value);
  332. void free_ini_info(ini_inforec *ini_info);
  333. int write_ini_file(ini_inforec *ini_info);
  334. char *open_ini_file(char *fname, ini_inforec *ini_info);
  335. char * increase_ini_allocation(ini_inforec *ini_info);
  336. int set_ini_value(ini_inforec *ini_info, char *area, char *indent, char *value);
  337. int read_ini_value(ini_inforec *ini_info, char *area, char *indent, char *value, int max_value);
  338. char * get_ini_line(char *buff, int max_len, long *pos, char *ini);
  339. void break_up_ini(char *buff, char *w1, char *w2);
  340. long find_ini_area(char *ini, char *area);
  341.  
  342.